"""
Utilities for pygem. This is not fully tested
"""
from functools import wraps

def debug(func):
	# Func is is function to be wrapped
	@wraps(func)
	def wrapper(*args, **kwargs):
		print(func.__name__) # TODO add logger here
		return func(*args, **kwargs)
	return wrapper

def debugmethods(cls):
	# cls is a class. classmethods and staticmethods will not be wrapped.
	for key, val in vars(cls).items():
		if callable(val):
			setattr(cls, key, debug(val))

	return cls

@debugmethods
class Spam:
	def foo(self):
		pass
	def bar(self):
		pass


if __name__ == '__main__':
	s = Spam()
	s.bar()
	s.foo()


